<?php   
    include_once '../source/database.php';
    include_once '/check_db_table.php';
    
    $query = "SELECT * FROM users";
    $users = new CheckTable($db,$query);
    
    //  column_exist FUNCTION CAN CHECK IF A COLUMN OR MORE IN AN ARRAY EXISTS IN THE TABLE DEFINED IN THE OBJECT. THE $query WE USED TO CREATE THE OBJECT IS THAT OBJECTS TABLE TO CHECK
    //  WE CAN MAKE AS MANY OBJECTS AS IS NEEDED FOR EACH TABLE
    $columnname= "Admin";

    if($users -> column_exist($columnname) ==false){
        $query = "ALTER TABLE users
                  ADD ".$columnname." TINYINT(1) NOT NULL DEFAULT 0";
        $db -> query($query);
    }
    
    //  MAKE SURE TO CAPITALIZE COLUMN NAMES PROPERLY WHEN YOU ADD THEM TO THE DATABASE PLZ
    $columnname = Array(
                'FirstName','LastName','Email','Address','Country','PostalCode');
    
    if($users -> column_exist($columnname)==false){
        //  EXAMPLE USING ARRAY TO CREATE MULTIBLE ROWS
        $query = "ALTER TABLE users
                  ADD (".$columnname[0]." VARCHAR(60) NOT NULL, 
                   ".$columnname[1]." VARCHAR(45) NOT NULL, 
                   ".$columnname[2]." VARCHAR(45) NOT NULL, 
                   ".$columnname[3]." VARCHAR(45) NOT NULL, 
                   ".$columnname[4]." VARCHAR(45) NOT NULL, 
                   ".$columnname[5]." VARCHAR(45) NOT NULL)";
        $db->query($query);
        echo '<br>Succesfully created this query<br>';
    }
    else if($users -> column_exist($columnname)==true){
        echo '<br>One or more columns exist in this object<br>';
    }
        
    $query ="INSERT INTO users(UserName,Password,Admin) VALUES('Admin',1234,1)";
    $db -> query($query);
    
    
    
    //  SQL STATEMENTS FOR OUR genre TABLE
    $query = "SELECT * FROM genre";
    $genre = new CheckTable($db,$query);
    
    
    
    //  SQL STATEMENTS FOR OUR item TABLE
    $query = "SELECT * FROM item";
    $item = new CheckTable($db,$query);
    
    
    
    //  SQL STATEMENTS FOR OUR itemgenre TABLE
    $query = "SELECT * FROM itemgenre";
    $itemgenre = new CheckTable($db,$query);
    
    
    
    //  SQL STATEMENTS FOR OUR itemimage TABLE
    $query = "SELECT * FROM itemimage";
    $itemimage = new CheckTable($db,$query);
    
    
    
    //  SQL STATEMENTS FOR OUR media TABLE
    $query = "SELECT * FROM media";
    $media = new CheckTable($db,$query);
    
    
    

    
?>